\(\int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx\) [13]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [B] (warning: unable to verify)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F(-1)]
   Mupad [F(-1)]

Optimal result

Integrand size = 33, antiderivative size = 352 \[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=-\frac {\sqrt {a-c-\sqrt {a^2+b^2-2 a c+c^2}} \arctan \left (\frac {b-\left (a-c-\sqrt {a^2+b^2-2 a c+c^2}\right ) \tan (d+e x)}{\sqrt {2} \sqrt {a-c-\sqrt {a^2+b^2-2 a c+c^2}} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {2} \sqrt {a^2+b^2-2 a c+c^2} e}+\frac {\sqrt {a-c+\sqrt {a^2+b^2-2 a c+c^2}} \arctan \left (\frac {b-\left (a-c+\sqrt {a^2+b^2-2 a c+c^2}\right ) \tan (d+e x)}{\sqrt {2} \sqrt {a-c+\sqrt {a^2+b^2-2 a c+c^2}} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {2} \sqrt {a^2+b^2-2 a c+c^2} e}+\frac {\text {arctanh}\left (\frac {b+2 c \tan (d+e x)}{2 \sqrt {c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {c} e} \]

[Out]

arctanh(1/2*(b+2*c*tan(e*x+d))/c^(1/2)/(a+b*tan(e*x+d)+c*tan(e*x+d)^2)^(1/2))/e/c^(1/2)-1/2*arctan(1/2*(b-(a-c
-(a^2-2*a*c+b^2+c^2)^(1/2))*tan(e*x+d))*2^(1/2)/(a-c-(a^2-2*a*c+b^2+c^2)^(1/2))^(1/2)/(a+b*tan(e*x+d)+c*tan(e*
x+d)^2)^(1/2))*(a-c-(a^2-2*a*c+b^2+c^2)^(1/2))^(1/2)/e*2^(1/2)/(a^2-2*a*c+b^2+c^2)^(1/2)+1/2*arctan(1/2*(b-(a-
c+(a^2-2*a*c+b^2+c^2)^(1/2))*tan(e*x+d))*2^(1/2)/(a-c+(a^2-2*a*c+b^2+c^2)^(1/2))^(1/2)/(a+b*tan(e*x+d)+c*tan(e
*x+d)^2)^(1/2))*(a-c+(a^2-2*a*c+b^2+c^2)^(1/2))^(1/2)/e*2^(1/2)/(a^2-2*a*c+b^2+c^2)^(1/2)

Rubi [A] (verified)

Time = 0.39 (sec) , antiderivative size = 352, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.212, Rules used = {3781, 1093, 635, 212, 1001, 1044, 211} \[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=-\frac {\sqrt {-\sqrt {a^2-2 a c+b^2+c^2}+a-c} \arctan \left (\frac {b-\left (-\sqrt {a^2-2 a c+b^2+c^2}+a-c\right ) \tan (d+e x)}{\sqrt {2} \sqrt {-\sqrt {a^2-2 a c+b^2+c^2}+a-c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {2} e \sqrt {a^2-2 a c+b^2+c^2}}+\frac {\sqrt {\sqrt {a^2-2 a c+b^2+c^2}+a-c} \arctan \left (\frac {b-\left (\sqrt {a^2-2 a c+b^2+c^2}+a-c\right ) \tan (d+e x)}{\sqrt {2} \sqrt {\sqrt {a^2-2 a c+b^2+c^2}+a-c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {2} e \sqrt {a^2-2 a c+b^2+c^2}}+\frac {\text {arctanh}\left (\frac {b+2 c \tan (d+e x)}{2 \sqrt {c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {c} e} \]

[In]

Int[Tan[d + e*x]^2/Sqrt[a + b*Tan[d + e*x] + c*Tan[d + e*x]^2],x]

[Out]

-((Sqrt[a - c - Sqrt[a^2 + b^2 - 2*a*c + c^2]]*ArcTan[(b - (a - c - Sqrt[a^2 + b^2 - 2*a*c + c^2])*Tan[d + e*x
])/(Sqrt[2]*Sqrt[a - c - Sqrt[a^2 + b^2 - 2*a*c + c^2]]*Sqrt[a + b*Tan[d + e*x] + c*Tan[d + e*x]^2])])/(Sqrt[2
]*Sqrt[a^2 + b^2 - 2*a*c + c^2]*e)) + (Sqrt[a - c + Sqrt[a^2 + b^2 - 2*a*c + c^2]]*ArcTan[(b - (a - c + Sqrt[a
^2 + b^2 - 2*a*c + c^2])*Tan[d + e*x])/(Sqrt[2]*Sqrt[a - c + Sqrt[a^2 + b^2 - 2*a*c + c^2]]*Sqrt[a + b*Tan[d +
 e*x] + c*Tan[d + e*x]^2])])/(Sqrt[2]*Sqrt[a^2 + b^2 - 2*a*c + c^2]*e) + ArcTanh[(b + 2*c*Tan[d + e*x])/(2*Sqr
t[c]*Sqrt[a + b*Tan[d + e*x] + c*Tan[d + e*x]^2])]/(Sqrt[c]*e)

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 635

Int[1/Sqrt[(a_) + (b_.)*(x_) + (c_.)*(x_)^2], x_Symbol] :> Dist[2, Subst[Int[1/(4*c - x^2), x], x, (b + 2*c*x)
/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 1001

Int[1/(((a_.) + (c_.)*(x_)^2)*Sqrt[(d_.) + (e_.)*(x_) + (f_.)*(x_)^2]), x_Symbol] :> With[{q = Rt[(c*d - a*f)^
2 + a*c*e^2, 2]}, Dist[1/(2*q), Int[(c*d - a*f + q + c*e*x)/((a + c*x^2)*Sqrt[d + e*x + f*x^2]), x], x] - Dist
[1/(2*q), Int[(c*d - a*f - q + c*e*x)/((a + c*x^2)*Sqrt[d + e*x + f*x^2]), x], x]] /; FreeQ[{a, c, d, e, f}, x
] && NeQ[e^2 - 4*d*f, 0] && NegQ[(-a)*c]

Rule 1044

Int[((g_) + (h_.)*(x_))/(((a_) + (c_.)*(x_)^2)*Sqrt[(d_.) + (e_.)*(x_) + (f_.)*(x_)^2]), x_Symbol] :> Dist[-2*
a*g*h, Subst[Int[1/Simp[2*a^2*g*h*c + a*e*x^2, x], x], x, Simp[a*h - g*c*x, x]/Sqrt[d + e*x + f*x^2]], x] /; F
reeQ[{a, c, d, e, f, g, h}, x] && EqQ[a*h^2*e + 2*g*h*(c*d - a*f) - g^2*c*e, 0]

Rule 1093

Int[((A_.) + (C_.)*(x_)^2)/(((a_) + (c_.)*(x_)^2)*Sqrt[(d_.) + (e_.)*(x_) + (f_.)*(x_)^2]), x_Symbol] :> Dist[
C/c, Int[1/Sqrt[d + e*x + f*x^2], x], x] + Dist[(A*c - a*C)/c, Int[1/((a + c*x^2)*Sqrt[d + e*x + f*x^2]), x],
x] /; FreeQ[{a, c, d, e, f, A, C}, x] && NeQ[e^2 - 4*d*f, 0]

Rule 3781

Int[tan[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*((f_.)*tan[(d_.) + (e_.)*(x_)])^(n_.) + (c_.)*((f_.)*tan[(d_.
) + (e_.)*(x_)])^(n2_.))^(p_), x_Symbol] :> Dist[f/e, Subst[Int[(x/f)^m*((a + b*x^n + c*x^(2*n))^p/(f^2 + x^2)
), x], x, f*Tan[d + e*x]], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && EqQ[n2, 2*n] && NeQ[b^2 - 4*a*c, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {x^2}{\left (1+x^2\right ) \sqrt {a+b x+c x^2}} \, dx,x,\tan (d+e x)\right )}{e} \\ & = \frac {\text {Subst}\left (\int \frac {1}{\sqrt {a+b x+c x^2}} \, dx,x,\tan (d+e x)\right )}{e}-\frac {\text {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \sqrt {a+b x+c x^2}} \, dx,x,\tan (d+e x)\right )}{e} \\ & = \frac {2 \text {Subst}\left (\int \frac {1}{4 c-x^2} \, dx,x,\frac {b+2 c \tan (d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{e}+\frac {\text {Subst}\left (\int \frac {a-c-\sqrt {a^2+b^2-2 a c+c^2}+b x}{\left (1+x^2\right ) \sqrt {a+b x+c x^2}} \, dx,x,\tan (d+e x)\right )}{2 \sqrt {a^2+b^2-2 a c+c^2} e}-\frac {\text {Subst}\left (\int \frac {a-c+\sqrt {a^2+b^2-2 a c+c^2}+b x}{\left (1+x^2\right ) \sqrt {a+b x+c x^2}} \, dx,x,\tan (d+e x)\right )}{2 \sqrt {a^2+b^2-2 a c+c^2} e} \\ & = \frac {\text {arctanh}\left (\frac {b+2 c \tan (d+e x)}{2 \sqrt {c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {c} e}-\frac {\left (b \left (a-c-\sqrt {a^2+b^2-2 a c+c^2}\right )\right ) \text {Subst}\left (\int \frac {1}{2 b \left (a-c-\sqrt {a^2+b^2-2 a c+c^2}\right )+b x^2} \, dx,x,\frac {b-\left (a-c-\sqrt {a^2+b^2-2 a c+c^2}\right ) \tan (d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {a^2+b^2-2 a c+c^2} e}+\frac {\left (b \left (a-c+\sqrt {a^2+b^2-2 a c+c^2}\right )\right ) \text {Subst}\left (\int \frac {1}{2 b \left (a-c+\sqrt {a^2+b^2-2 a c+c^2}\right )+b x^2} \, dx,x,\frac {b-\left (a-c+\sqrt {a^2+b^2-2 a c+c^2}\right ) \tan (d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {a^2+b^2-2 a c+c^2} e} \\ & = -\frac {\sqrt {a-c-\sqrt {a^2+b^2-2 a c+c^2}} \arctan \left (\frac {b-\left (a-c-\sqrt {a^2+b^2-2 a c+c^2}\right ) \tan (d+e x)}{\sqrt {2} \sqrt {a-c-\sqrt {a^2+b^2-2 a c+c^2}} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {2} \sqrt {a^2+b^2-2 a c+c^2} e}+\frac {\sqrt {a-c+\sqrt {a^2+b^2-2 a c+c^2}} \arctan \left (\frac {b-\left (a-c+\sqrt {a^2+b^2-2 a c+c^2}\right ) \tan (d+e x)}{\sqrt {2} \sqrt {a-c+\sqrt {a^2+b^2-2 a c+c^2}} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {2} \sqrt {a^2+b^2-2 a c+c^2} e}+\frac {\text {arctanh}\left (\frac {b+2 c \tan (d+e x)}{2 \sqrt {c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {c} e} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.25 (sec) , antiderivative size = 228, normalized size of antiderivative = 0.65 \[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=\frac {\frac {i \text {arctanh}\left (\frac {2 a-i b+(b-2 i c) \tan (d+e x)}{2 \sqrt {a-i b-c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{2 \sqrt {a-i b-c}}-\frac {i \text {arctanh}\left (\frac {2 a+i b+(b+2 i c) \tan (d+e x)}{2 \sqrt {a+i b-c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{2 \sqrt {a+i b-c}}+\frac {\text {arctanh}\left (\frac {b+2 c \tan (d+e x)}{2 \sqrt {c} \sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}}\right )}{\sqrt {c}}}{e} \]

[In]

Integrate[Tan[d + e*x]^2/Sqrt[a + b*Tan[d + e*x] + c*Tan[d + e*x]^2],x]

[Out]

(((I/2)*ArcTanh[(2*a - I*b + (b - (2*I)*c)*Tan[d + e*x])/(2*Sqrt[a - I*b - c]*Sqrt[a + b*Tan[d + e*x] + c*Tan[
d + e*x]^2])])/Sqrt[a - I*b - c] - ((I/2)*ArcTanh[(2*a + I*b + (b + (2*I)*c)*Tan[d + e*x])/(2*Sqrt[a + I*b - c
]*Sqrt[a + b*Tan[d + e*x] + c*Tan[d + e*x]^2])])/Sqrt[a + I*b - c] + ArcTanh[(b + 2*c*Tan[d + e*x])/(2*Sqrt[c]
*Sqrt[a + b*Tan[d + e*x] + c*Tan[d + e*x]^2])]/Sqrt[c])/e

Maple [B] (warning: unable to verify)

result has leaf size over 500,000. Avoiding possible recursion issues.

Time = 1.02 (sec) , antiderivative size = 7491751, normalized size of antiderivative = 21283.38

\[\text {output too large to display}\]

[In]

int(tan(e*x+d)^2/(a+b*tan(e*x+d)+c*tan(e*x+d)^2)^(1/2),x)

[Out]

result too large to display

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 4980 vs. \(2 (313) = 626\).

Time = 0.99 (sec) , antiderivative size = 9961, normalized size of antiderivative = 28.30 \[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=\text {Too large to display} \]

[In]

integrate(tan(e*x+d)^2/(a+b*tan(e*x+d)+c*tan(e*x+d)^2)^(1/2),x, algorithm="fricas")

[Out]

Too large to include

Sympy [F]

\[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=\int \frac {\tan ^{2}{\left (d + e x \right )}}{\sqrt {a + b \tan {\left (d + e x \right )} + c \tan ^{2}{\left (d + e x \right )}}}\, dx \]

[In]

integrate(tan(e*x+d)**2/(a+b*tan(e*x+d)+c*tan(e*x+d)**2)**(1/2),x)

[Out]

Integral(tan(d + e*x)**2/sqrt(a + b*tan(d + e*x) + c*tan(d + e*x)**2), x)

Maxima [F]

\[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=\int { \frac {\tan \left (e x + d\right )^{2}}{\sqrt {c \tan \left (e x + d\right )^{2} + b \tan \left (e x + d\right ) + a}} \,d x } \]

[In]

integrate(tan(e*x+d)^2/(a+b*tan(e*x+d)+c*tan(e*x+d)^2)^(1/2),x, algorithm="maxima")

[Out]

integrate(tan(e*x + d)^2/sqrt(c*tan(e*x + d)^2 + b*tan(e*x + d) + a), x)

Giac [F(-1)]

Timed out. \[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=\text {Timed out} \]

[In]

integrate(tan(e*x+d)^2/(a+b*tan(e*x+d)+c*tan(e*x+d)^2)^(1/2),x, algorithm="giac")

[Out]

Timed out

Mupad [F(-1)]

Timed out. \[ \int \frac {\tan ^2(d+e x)}{\sqrt {a+b \tan (d+e x)+c \tan ^2(d+e x)}} \, dx=\int \frac {{\mathrm {tan}\left (d+e\,x\right )}^2}{\sqrt {c\,{\mathrm {tan}\left (d+e\,x\right )}^2+b\,\mathrm {tan}\left (d+e\,x\right )+a}} \,d x \]

[In]

int(tan(d + e*x)^2/(a + b*tan(d + e*x) + c*tan(d + e*x)^2)^(1/2),x)

[Out]

int(tan(d + e*x)^2/(a + b*tan(d + e*x) + c*tan(d + e*x)^2)^(1/2), x)